Misc minor fixes for the !NEW_STRINGS case.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 23 Oct 2013 03:29:26 +0000 (03:29 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 23 Oct 2013 03:29:26 +0000 (03:29 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4640 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/garmin_gpi.cc
gpsbabel/lowranceusr.cc
gpsbabel/mapsend.cc
gpsbabel/raymarine.cc

index a5342c5b9f55d9237fd6d81fb64117361b1da521..1b873f3734314d006f670b9a96fb7b089a3b7a77 100644 (file)
@@ -1317,7 +1317,7 @@ enum_waypt_cb(const waypoint* ref)
     wpt->shortname = str;
 #else
     xfree(wpt->shortname);
-    wpt->shortname = str;
+    wpt->shortname = xstrdup(str);
 #endif
   }
 
index e13e8e7bc77b16e3a25e931aaad0ccaa8bd6cf95..2f1e1d1f710b6e8293b02bb62bf618289d378f5e 100644 (file)
@@ -721,6 +721,7 @@ lowranceusr_waypt_disp(const waypoint* wpt)
     } else if (!wpt->description.isEmpty()) {
       name = wpt->description;
 #else
+  char* name = NULL;
   if ((! wpt->shortname) || global_opts.synthesize_shortnames) {
     if (wpt->description && global_opts.synthesize_shortnames) {
       name = mkshort_from_wpt(mkshort_handle, wpt);
@@ -734,15 +735,19 @@ lowranceusr_waypt_disp(const waypoint* wpt)
     name = wpt->shortname;
   }
 
+#if NEW_STRINGS
   text_len = name.length();
+#else
+  text_len = strlen(name);
+#endif
   if (text_len > MAXUSRSTRINGSIZE) {
     text_len = MAXUSRSTRINGSIZE;
   }
   gbfputint32(text_len, file_out);
-  gbfwrite(CSTR(name), 1, text_len, file_out);
+  gbfwrite(CSTRc(name), 1, text_len, file_out);
 
   if (global_opts.debug_level >= 1) {
-    printf(MYNAME " waypt_disp: Waypt name = %s\n", CSTR(name));
+    printf(MYNAME " waypt_disp: Waypt name = %s\n", CSTRc(name));
   }
 
   /**
index 7a6f842a6cefdc1a92fe070e1b1c5a86de1e1eba..4c31035769b92c68b8688ddc80d55ff27b50009c 100644 (file)
@@ -278,7 +278,6 @@ mapsend_waypt_pr(const waypoint* waypointp)
   QString sn = global_opts.synthesize_shortnames ?
                    mkshort_from_wpt(mkshort_handle, waypointp) :
                    waypointp->shortname;
-  QString tmp;
 
   /*
    * The format spec doesn't call out the character set of waypoint
@@ -296,8 +295,8 @@ mapsend_waypt_pr(const waypoint* waypointp)
    */
 
 
-  tmp = mkshort(wpt_handle, sn);
-  gbfputpstr(tmp, mapsend_file_out);
+  QString tmp1 = mkshort(wpt_handle, sn);
+  gbfputpstr(tmp1, mapsend_file_out);
 
 #if NEW_STRINGS
   c = waypointp->description.length();
@@ -307,7 +306,7 @@ mapsend_waypt_pr(const waypoint* waypointp)
   gbfputc(c, mapsend_file_out);
   gbfwrite(CSTR(waypointp->description), 1, c, mapsend_file_out);
 #else
-  tmp = waypointp->description;
+  char* tmp = waypointp->description;
   if (tmp) {
     c = strlen(tmp);
   } else {
index cbe6051bc3b80f76663c860075e126f5b6223d56..a44f4403c55b553618f60e35654e754d8e40e9e8 100644 (file)
@@ -311,7 +311,7 @@ register_waypt(const waypoint* ref, const char is_rtept)
     }
   }
 
-  wpt->extra_data = (void*)mkshort(hshort_wpt, CSTR(wpt->shortname));
+  wpt->extra_data = (void*)mkshort(hshort_wpt, CSTRc(wpt->shortname));
 
   waypt_table[waypt_table_ct] = (waypoint*)wpt;
   waypt_table_ct++;